<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>UC-CW-002：课件创建和编辑原型</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd@5.12.8/dist/reset.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }
        
        .header {
            background: #fff;
            padding: 16px 24px;
            border-bottom: 1px solid #e8e8e8;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        
        .breadcrumb {
            color: #666;
            font-size: 14px;
        }
        
        .breadcrumb a {
            color: #1890ff;
            text-decoration: none;
        }
        
        .main-content {
            padding: 24px;
            max-width: 1400px;
            margin: 0 auto;
        }
        
        .step-navigation {
            background: #fff;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 16px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        
        .step-list {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .step-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            flex: 1;
            position: relative;
        }
        
        .step-item:not(:last-child)::after {
            content: '';
            position: absolute;
            top: 20px;
            right: -50%;
            width: 100%;
            height: 2px;
            background: #d9d9d9;
            z-index: 1;
        }
        
        .step-item.completed:not(:last-child)::after {
            background: #52c41a;
        }
        
        .step-circle {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            position: relative;
            z-index: 2;
            background: #fff;
            border: 2px solid #d9d9d9;
            color: #999;
        }
        
        .step-item.completed .step-circle {
            background: #52c41a;
            border-color: #52c41a;
            color: #fff;
        }
        
        .step-item.current .step-circle {
            background: #1890ff;
            border-color: #1890ff;
            color: #fff;
        }
        
        .step-title {
            margin-top: 8px;
            font-size: 14px;
            color: #666;
        }
        
        .step-item.completed .step-title,
        .step-item.current .step-title {
            color: #333;
            font-weight: 500;
        }
        
        .content-area {
            background: #fff;
            border-radius: 8px;
            padding: 24px;
            margin-bottom: 16px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            min-height: 500px;
        }
        
        .form-section {
            margin-bottom: 24px;
        }
        
        .form-section h3 {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 16px;
            color: #333;
            border-bottom: 1px solid #f0f0f0;
            padding-bottom: 8px;
        }
        
        .form-row {
            display: flex;
            gap: 16px;
            margin-bottom: 16px;
        }
        
        .form-item {
            flex: 1;
            display: flex;
            flex-direction: column;
        }
        
        .form-item.full-width {
            flex: 100%;
        }
        
        .form-item label {
            font-size: 14px;
            color: #333;
            margin-bottom: 4px;
            font-weight: 500;
        }
        
        .form-item label.required::after {
            content: ' *';
            color: #ff4d4f;
        }
        
        .form-item input,
        .form-item select,
        .form-item textarea {
            padding: 8px 12px;
            border: 1px solid #d9d9d9;
            border-radius: 6px;
            font-size: 14px;
            transition: border-color 0.3s;
        }
        
        .form-item input:focus,
        .form-item select:focus,
        .form-item textarea:focus {
            outline: none;
            border-color: #1890ff;
            box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
        }
        
        .form-item textarea {
            resize: vertical;
            min-height: 80px;
        }
        
        .upload-area {
            border: 2px dashed #d9d9d9;
            border-radius: 8px;
            padding: 40px 20px;
            text-align: center;
            background: #fafafa;
            transition: border-color 0.3s;
            cursor: pointer;
        }
        
        .upload-area:hover {
            border-color: #1890ff;
        }
        
        .upload-area.dragover {
            border-color: #1890ff;
            background: #f0f8ff;
        }
        
        .upload-icon {
            font-size: 48px;
            color: #d9d9d9;
            margin-bottom: 16px;
        }
        
        .upload-text {
            color: #666;
            font-size: 14px;
            margin-bottom: 8px;
        }
        
        .upload-hint {
            color: #999;
            font-size: 12px;
        }
        
        .video-preview {
            margin-top: 16px;
            border-radius: 8px;
            overflow: hidden;
            background: #000;
        }
        
        .video-player {
            width: 100%;
            height: 300px;
            background: #000;
            position: relative;
        }
        
        .video-controls {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(transparent, rgba(0,0,0,0.7));
            padding: 20px;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .play-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: #1890ff;
            border: none;
            color: #fff;
            font-size: 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .progress-bar {
            flex: 1;
            height: 4px;
            background: rgba(255,255,255,0.3);
            border-radius: 2px;
            position: relative;
            cursor: pointer;
        }
        
        .progress-fill {
            height: 100%;
            background: #1890ff;
            border-radius: 2px;
            width: 30%;
        }
        
        .time-display {
            color: #fff;
            font-size: 12px;
            white-space: nowrap;
        }
        
        .disassemble-config {
            background: #f8f9fa;
            padding: 16px;
            border-radius: 6px;
            margin-top: 16px;
        }
        
        .config-row {
            display: flex;
            gap: 16px;
            align-items: center;
            margin-bottom: 12px;
        }
        
        .config-item {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .config-item label {
            font-size: 14px;
            color: #333;
            margin: 0;
        }
        
        .config-item input[type="number"] {
            width: 80px;
            padding: 4px 8px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
        }
        
        .config-item input[type="radio"] {
            margin-right: 4px;
        }
        
        .steps-list {
            margin-top: 16px;
        }
        
        .step-item-card {
            background: #f8f9fa;
            border: 1px solid #e9ecef;
            border-radius: 6px;
            padding: 12px;
            margin-bottom: 8px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .step-info {
            flex: 1;
        }
        
        .step-name {
            font-weight: 500;
            color: #333;
            margin-bottom: 4px;
        }
        
        .step-time {
            font-size: 12px;
            color: #666;
        }
        
        .step-actions {
            display: flex;
            gap: 8px;
        }
        
        .btn {
            padding: 6px 12px;
            border: 1px solid;
            border-radius: 4px;
            font-size: 12px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
            transition: all 0.3s;
        }
        
        .btn-primary {
            background: #1890ff;
            border-color: #1890ff;
            color: #fff;
        }
        
        .btn-default {
            background: #fff;
            border-color: #d9d9d9;
            color: #333;
        }
        
        .btn-danger {
            background: #fff;
            border-color: #ff4d4f;
            color: #ff4d4f;
        }
        
        .btn:hover {
            opacity: 0.8;
        }
        
        .knowledge-search {
            margin-bottom: 16px;
        }
        
        .search-box {
            position: relative;
            margin-bottom: 12px;
        }
        
        .search-box input {
            width: 100%;
            padding-right: 40px;
        }
        
        .search-icon {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: #999;
        }
        
        .search-filters {
            display: flex;
            gap: 12px;
            margin-bottom: 16px;
        }
        
        .filter-select {
            padding: 6px 12px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            font-size: 12px;
        }
        
        .search-results {
            max-height: 300px;
            overflow-y: auto;
            border: 1px solid #e9ecef;
            border-radius: 6px;
        }
        
        .search-result-item {
            padding: 12px;
            border-bottom: 1px solid #f0f0f0;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        
        .search-result-item:hover {
            background: #f8f9fa;
        }
        
        .search-result-item:last-child {
            border-bottom: none;
        }
        
        .result-title {
            font-weight: 500;
            color: #333;
            margin-bottom: 4px;
        }
        
        .result-content {
            font-size: 12px;
            color: #666;
            margin-bottom: 4px;
        }
        
        .result-meta {
            font-size: 11px;
            color: #999;
        }
        
        .associated-knowledge {
            margin-top: 16px;
        }
        
        .knowledge-tag {
            display: inline-block;
            background: #e6f7ff;
            color: #1890ff;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 12px;
            margin-right: 8px;
            margin-bottom: 8px;
        }
        
        .knowledge-tag .remove {
            margin-left: 4px;
            cursor: pointer;
        }
        
        .action-buttons {
            background: #fff;
            padding: 16px 24px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .btn-group {
            display: flex;
            gap: 12px;
        }
        
        .btn-large {
            padding: 10px 20px;
            font-size: 14px;
        }
        
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        
        .modal-content {
            background: #fff;
            border-radius: 8px;
            padding: 24px;
            max-width: 600px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .modal-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
        }
        
        .modal-close {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #999;
        }
        
        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            margin-top: 20px;
        }
        
        @media (max-width: 768px) {
            .step-list {
                flex-direction: column;
                gap: 16px;
            }
            
            .step-item:not(:last-child)::after {
                display: none;
            }
            
            .form-row {
                flex-direction: column;
            }
            
            .config-row {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .search-filters {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
    <!-- 页面头部 -->
    <div class="header">
        <div class="breadcrumb">
            <a href="#">首页</a> > <a href="#">课件管理</a> > 编辑课件：<span id="coursewareName">基础操作培训</span>
        </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
        <!-- 步骤导航 -->
        <div class="step-navigation">
            <div class="step-list">
                <div class="step-item completed">
                    <div class="step-circle">✓</div>
                    <div class="step-title">基础信息</div>
                </div>
                <div class="step-item current">
                    <div class="step-circle">2</div>
                    <div class="step-title">视频内容</div>
                </div>
                <div class="step-item">
                    <div class="step-circle">3</div>
                    <div class="step-title">步骤配置</div>
                </div>
                <div class="step-item">
                    <div class="step-circle">4</div>
                    <div class="step-title">知识关联</div>
                </div>
                <div class="step-item">
                    <div class="step-circle">5</div>
                    <div class="step-title">保存发布</div>
                </div>
            </div>
        </div>

        <!-- 内容编辑区域 -->
        <div class="content-area">
            <!-- 视频上传区域 -->
            <div class="form-section">
                <h3>视频内容配置</h3>
                
                <div class="form-item full-width">
                    <label>视频上传</label>
                    <div class="upload-area" id="uploadArea">
                        <div class="upload-icon">📹</div>
                        <div class="upload-text">拖拽上传或点击上传视频文件</div>
                        <div class="upload-hint">支持格式: MP4, AVI, MOV | 文件大小: ≤500MB | 视频时长: ≤60分钟</div>
                    </div>
                </div>

                <!-- 视频预览 -->
                <div class="video-preview" id="videoPreview" style="display: none;">
                    <div class="video-player">
                        <div class="video-controls">
                            <button class="play-btn">▶️</button>
                            <div class="progress-bar">
                                <div class="progress-fill"></div>
                            </div>
                            <div class="time-display">0:30 / 30:00</div>
                        </div>
                    </div>
                </div>

                <!-- 拆解配置 -->
                <div class="disassemble-config">
                    <h4 style="margin-bottom: 12px; color: #333;">拆解配置</h4>
                    <div class="config-row">
                        <div class="config-item">
                            <label>拆解精度:</label>
                            <label><input type="radio" name="precision" value="1" checked> 1秒</label>
                            <label><input type="radio" name="precision" value="2"> 2秒</label>
                            <label><input type="radio" name="precision" value="5"> 5秒</label>
                        </div>
                    </div>
                    <div class="config-row">
                        <div class="config-item">
                            <label>最小步骤时长:</label>
                            <input type="number" value="3" min="1" max="60"> 秒
                        </div>
                        <div class="config-item">
                            <label>最大步骤数:</label>
                            <input type="number" value="50" min="1" max="100"> 个
                        </div>
                    </div>
                    <div class="config-row">
                        <button class="btn btn-primary">自动拆解</button>
                        <button class="btn btn-default">手动标记</button>
                        <button class="btn btn-default">重新拆解</button>
                    </div>
                </div>

                <!-- 步骤列表 -->
                <div class="steps-list" id="stepsList" style="display: none;">
                    <h4 style="margin-bottom: 12px; color: #333;">拆解结果</h4>
                    <div class="step-item-card">
                        <div class="step-info">
                            <div class="step-name">准备工具</div>
                            <div class="step-time">0:00 - 0:30 (30秒)</div>
                        </div>
                        <div class="step-actions">
                            <button class="btn btn-default">编辑</button>
                            <button class="btn btn-danger">删除</button>
                        </div>
                    </div>
                    <div class="step-item-card">
                        <div class="step-info">
                            <div class="step-name">开始操作</div>
                            <div class="step-time">0:30 - 1:00 (30秒)</div>
                        </div>
                        <div class="step-actions">
                            <button class="btn btn-default">编辑</button>
                            <button class="btn btn-danger">删除</button>
                        </div>
                    </div>
                    <div class="step-item-card">
                        <div class="step-info">
                            <div class="step-name">完成检查</div>
                            <div class="step-time">1:00 - 1:30 (30秒)</div>
                        </div>
                        <div class="step-actions">
                            <button class="btn btn-default">编辑</button>
                            <button class="btn btn-danger">删除</button>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 知识关联区域 -->
            <div class="form-section" id="knowledgeSection" style="display: none;">
                <h3>知识关联配置</h3>
                
                <div class="knowledge-search">
                    <div class="search-box">
                        <input type="text" placeholder="搜索知识内容..." id="knowledgeSearch">
                        <span class="search-icon">🔍</span>
                    </div>
                    
                    <div class="search-filters">
                        <select class="filter-select">
                            <option value="">全部分类</option>
                            <option value="safety">安全规范</option>
                            <option value="operation">操作指南</option>
                            <option value="equipment">设备说明</option>
                        </select>
                        <select class="filter-select">
                            <option value="">全部语言</option>
                            <option value="zh">中文</option>
                            <option value="en">英文</option>
                            <option value="vi">越南语</option>
                        </select>
                    </div>
                    
                    <div class="search-results" id="searchResults" style="display: none;">
                        <div class="search-result-item">
                            <div class="result-title">安全操作规范</div>
                            <div class="result-content">操作前必须佩戴安全防护用品，确保工作环境安全...</div>
                            <div class="result-meta">分类: 安全规范 | 语言: 中文 | 关联度: 95%</div>
                        </div>
                        <div class="search-result-item">
                            <div class="result-title">设备维护指南</div>
                            <div class="result-content">定期检查设备状态，及时更换磨损部件...</div>
                            <div class="result-meta">分类: 操作指南 | 语言: 中文 | 关联度: 88%</div>
                        </div>
                    </div>
                </div>

                <div class="associated-knowledge">
                    <h4 style="margin-bottom: 12px; color: #333;">已关联知识</h4>
                    <div class="knowledge-tag">
                        安全操作规范 <span class="remove">×</span>
                    </div>
                    <div class="knowledge-tag">
                        设备维护指南 <span class="remove">×</span>
                    </div>
                </div>
            </div>
        </div>

        <!-- 操作按钮 -->
        <div class="action-buttons">
            <div class="btn-group">
                <button class="btn btn-default btn-large">上一步</button>
                <button class="btn btn-default btn-large">保存草稿</button>
                <button class="btn btn-default btn-large">预览</button>
            </div>
            <div class="btn-group">
                <button class="btn btn-primary btn-large">下一步</button>
                <button class="btn btn-primary btn-large" id="publishBtn" style="display: none;">发布</button>
                <button class="btn btn-default btn-large">取消</button>
            </div>
        </div>
    </div>

    <!-- 步骤编辑弹窗 -->
    <div class="modal" id="stepEditModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title">编辑步骤 - 准备工具</h3>
                <button class="modal-close" onclick="closeModal()">&times;</button>
            </div>
            <div class="modal-body">
                <div class="form-item">
                    <label class="required">步骤名称</label>
                    <input type="text" value="准备工具">
                </div>
                <div class="form-item">
                    <label>步骤描述</label>
                    <textarea placeholder="请输入步骤描述">准备所需工具和材料</textarea>
                </div>
                <div class="form-row">
                    <div class="form-item">
                        <label>开始时间</label>
                        <input type="text" value="0:00">
                    </div>
                    <div class="form-item">
                        <label>结束时间</label>
                        <input type="text" value="0:30">
                    </div>
                </div>
                <div class="form-item">
                    <label>
                        <input type="checkbox" checked> 是否必修
                    </label>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" onclick="closeModal()">取消</button>
                <button class="btn btn-primary">保存</button>
            </div>
        </div>
    </div>

    <script>
        // 步骤导航切换
        function switchStep(stepNumber) {
            // 更新步骤状态
            document.querySelectorAll('.step-item').forEach((item, index) => {
                item.classList.remove('current');
                if (index < stepNumber - 1) {
                    item.classList.add('completed');
                } else if (index === stepNumber - 1) {
                    item.classList.add('current');
                } else {
                    item.classList.remove('completed');
                }
            });

            // 显示对应内容
            const contentArea = document.querySelector('.content-area');
            if (stepNumber === 2) {
                // 视频内容步骤
                document.getElementById('videoPreview').style.display = 'block';
                document.getElementById('stepsList').style.display = 'block';
                document.getElementById('knowledgeSection').style.display = 'none';
            } else if (stepNumber === 4) {
                // 知识关联步骤
                document.getElementById('videoPreview').style.display = 'none';
                document.getElementById('stepsList').style.display = 'none';
                document.getElementById('knowledgeSection').style.display = 'block';
            } else if (stepNumber === 5) {
                // 保存发布步骤
                document.getElementById('publishBtn').style.display = 'inline-block';
            }
        }

        // 文件上传处理
        const uploadArea = document.getElementById('uploadArea');
        uploadArea.addEventListener('click', () => {
            const input = document.createElement('input');
            input.type = 'file';
            input.accept = 'video/*';
            input.onchange = (e) => {
                const file = e.target.files[0];
                if (file) {
                    handleFileUpload(file);
                }
            };
            input.click();
        });

        uploadArea.addEventListener('dragover', (e) => {
            e.preventDefault();
            uploadArea.classList.add('dragover');
        });

        uploadArea.addEventListener('dragleave', () => {
            uploadArea.classList.remove('dragover');
        });

        uploadArea.addEventListener('drop', (e) => {
            e.preventDefault();
            uploadArea.classList.remove('dragover');
            const file = e.dataTransfer.files[0];
            if (file) {
                handleFileUpload(file);
            }
        });

        function handleFileUpload(file) {
            console.log('上传文件:', file.name);
            // 模拟文件上传
            setTimeout(() => {
                document.getElementById('videoPreview').style.display = 'block';
                document.getElementById('stepsList').style.display = 'block';
            }, 1000);
        }

        // 拆解配置
        document.querySelectorAll('input[name="precision"]').forEach(radio => {
            radio.addEventListener('change', (e) => {
                console.log('拆解精度:', e.target.value);
            });
        });

        // 知识搜索
        const knowledgeSearch = document.getElementById('knowledgeSearch');
        knowledgeSearch.addEventListener('input', (e) => {
            if (e.target.value.length > 2) {
                document.getElementById('searchResults').style.display = 'block';
            } else {
                document.getElementById('searchResults').style.display = 'none';
            }
        });

        // 知识关联
        document.querySelectorAll('.search-result-item').forEach(item => {
            item.addEventListener('click', () => {
                const title = item.querySelector('.result-title').textContent;
                addKnowledgeTag(title);
            });
        });

        function addKnowledgeTag(title) {
            const tag = document.createElement('div');
            tag.className = 'knowledge-tag';
            tag.innerHTML = `${title} <span class="remove" onclick="removeKnowledgeTag(this)">×</span>`;
            document.querySelector('.associated-knowledge').appendChild(tag);
        }

        function removeKnowledgeTag(element) {
            element.parentElement.remove();
        }

        // 步骤编辑
        document.querySelectorAll('.step-actions .btn-default').forEach(btn => {
            if (btn.textContent.includes('编辑')) {
                btn.addEventListener('click', () => {
                    document.getElementById('stepEditModal').style.display = 'flex';
                });
            }
        });

        // 关闭弹窗
        function closeModal() {
            document.getElementById('stepEditModal').style.display = 'none';
        }

        // 点击弹窗外部关闭
        document.getElementById('stepEditModal').addEventListener('click', (e) => {
            if (e.target.id === 'stepEditModal') {
                closeModal();
            }
        });

        // 按钮事件
        document.querySelector('.btn-primary').addEventListener('click', () => {
            // 自动拆解
            console.log('开始自动拆解...');
            setTimeout(() => {
                document.getElementById('stepsList').style.display = 'block';
            }, 2000);
        });

        // 下一步按钮
        document.querySelectorAll('.btn-primary')[1].addEventListener('click', () => {
            const currentStep = document.querySelector('.step-item.current .step-circle').textContent;
            if (currentStep === '2') {
                switchStep(3);
            } else if (currentStep === '3') {
                switchStep(4);
            } else if (currentStep === '4') {
                switchStep(5);
            }
        });

        // 上一步按钮
        document.querySelector('.btn-default').addEventListener('click', () => {
            const currentStep = document.querySelector('.step-item.current .step-circle').textContent;
            if (currentStep === '3') {
                switchStep(2);
            } else if (currentStep === '4') {
                switchStep(3);
            } else if (currentStep === '5') {
                switchStep(4);
            }
        });
    </script>
</body>
</html>

